/**
 * Created by LeungZ on 2016/8/8.
 */
import './overview.scss';
import temp from './overview.html';
import ctrl from './overview.ctrl.js';

export default angular.module('ctg-k8sconsole').config(['$stateProvider', $stateProvider=> {
    $stateProvider.state('k8s-overview', {
        url: '/k8s/overview?kDbCode',
        templateUrl: temp,
        controller: ctrl,
        controllerAs: 'ov',
        resolve: {
            cluster: ['clusterSrv', 'ctgNotification', '$stateParams',
                function (clusterSrv, ctgNotification, $stateParams) {
                    return clusterSrv.getClusterInfo($stateParams.kDbCode).catch(function (data) {
                        ctgNotification.error('获取概览详细数据有误.');
                    });
                }],
            node: ['nodeSrv', 'ctgNotification', '$stateParams', function (nodeSrv, ctgNotification, $stateParams) {
                return nodeSrv.getNodeList({perPage: 18, page: 1, code: $stateParams.kDbCode}).catch(function (data) {
                    ctgNotification.error('获取宿主机列表数据有误.');
                });
            }],
            detail: ['clusterSrv', 'ctgNotification', '$stateParams',
                function (clusterSrv, ctgNotification, $stateParams) {
                    return clusterSrv.getClusterList({
                        clusterCode: $stateParams.kDbCode,
                        perPage: 1,
                        currentPage: 1
                    });
                }]
        }
    })
}]);